const Mock = require('mockjs')
const Random=Mock.Random
const phonePrefix=['132','135','189']
const index=Math.floor(Math.random()*phonePrefix.length)
var phone=phonePrefix[index] + Mock.mock(/\d{8}/)

const data = Mock.mock({
<<<<<<< HEAD
  // 订单
=======
>>>>>>> 37a3803b6eced553603c19707d9ffd327d790750
  'items|200': [{
    id: '@increment',
    oid:Random.id(),
    datetime:Random.datetime(),
    "name|1":"test",
    "price|1":"￥18732",
    "payment|+1":[
    "未支付",
    "微信支付",
    "支付宝支付"],
    "source|1":"APP订单",
    "state|+1":[
    "已关闭",
    "已发货",
    "待发货",
    "已完成"],

<<<<<<< HEAD
    //商品
    image:Random.image(),
    "name_1|+1":["华为 HUAWEI P20 品牌：华为",
    "小米8 全面屏游戏智能手机 6GB+64GB 黑色 全网通4G 双卡双待 品牌：小米",
    "小米 红米5A 全网通版 3GB+32GB 香槟金 移动联通电信4G手机 双卡双待 品牌：小米",
    "Apple iPhone 8 Plus 64GB 红色特别版 移动联通电信4G手机 品牌：苹果",
    "HLA海澜之家简约动物印花短袖T恤 品牌：海澜之家"],

    "price_1|+1":["价格：￥3788 货号：6946605",
    "价格：￥2699 货号：7437788",
    "价格：￥649 货号：7437789",
    "价格：￥5499 货号：7437799",
    "价格：￥98 货号：HNTBJ2E042A"],
    "paixu|+1":[
    "100",
    "0",
    "0"],
    "xiaoliang|1":"0",
    "state_1|+1":[
    "未审核",],



=======
>>>>>>> 37a3803b6eced553603c19707d9ffd327d790750
  }]
})

module.exports = [
  {
    url: '/vue-admin-template/student/list',
    type: 'get',
    response: config => {
      const {page = 1, limit = 20, name } = config.query
      let mockList = data.items.filter(item => {
        if (name && item.name.indexOf(name) < 0) return false
        return true
      })
      // compute page list according to page size and page index
      const pageList = mockList.filter((item, index) => index < limit * page && index >= limit * (page -1))
      return {
        code: 20000,
        data: {
          total: mockList.length,
          items: pageList
        }
      }
    }
  },
  {
    url:'/vue-admin-template/student/update',
    type: 'post',
    response: _ => {
      return{
        code: 20000,
        data: 'success'
      }
    }
  },
  {
    url:'/vue-admin-template/student/create',
    type: 'post',
    response: _ => {
      return{
        code: 20000,
        data: 'success'
      }
    }
  }
]
